#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.68])
AC_INIT( assistant, 0.1, linzhanyu@gmail.com )
AC_CONFIG_SRCDIR([search/source/main.cpp])
AC_CONFIG_HEADERS([config.h])
AM_INIT_AUTOMAKE( assistant, 0.1 )

# Checks for programs.
AC_PROG_CXX
AC_PROG_CC
AC_PROG_RANLIB
AC_PROG_LIBTOOL
AC_PROG_MKDIR_P
AC_CONFIG_MACRO_DIR([m4])
AC_MSG_CHECKING([whether to build with debug information])
############################################################
# debug compilation support
############################################################
AC_ARG_ENABLE([debug],
	[AS_HELP_STRING([--enable-debug],
					[enable debug data generation (def=no)])],
	[debugit="$enableval"],
	[debugit=no])
AC_MSG_RESULT([$debugit])

if test x"$debugit" = x"yes"; then
	AC_DEFINE([DEBUG], [], [Debug Mode])
	AM_CXXFLAGS="$AM_CXXFLAGS -g -Wall -Werror -Wno-uninitialized -O0"
	CXXFLAGS=""
else
	AC_DEFINE([NDEBUG], [], [No-debug Mode])
	AM_CXXFLAGS="$AM_CXXFLAGS -O2 -pthread"
	CXXFLAGS=""
fi
############################################################

# Checks for libraries.
# AC_CHECK_LIB([boost_program_options], [dl])

# Checks for header files.
# AC_CHECK_HEADERS([arpa/inet.h limits.h locale.h malloc.h memory.h netdb.h netinet/in.h stdint.h stdlib.h string.h sys/socket.h sys/time.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_C_INLINE
AC_TYPE_SIZE_T
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_INT8_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_TYPE_UINT8_T

# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_REALLOC
# AC_CHECK_FUNCS([gethostbyname gettimeofday inet_ntoa memset select setlocale socket sqrt strerror])

AC_SUBST([AM_CXXFLAGS])
AC_SUBST([CXXFLAGS])

AC_OUTPUT( Makefile
		   base/Makefile
		   search/Makefile
		   )
# AC_OUTPUT
